package com.insea.dao.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.insea.dao.ExamenDao;
import com.insea.model.Acte;
import com.insea.model.Examen;
import com.insea.model.Facture;
import com.insea.model.Patient;

@Repository("examenDao")
public class ExamenDaoHibernate extends GenericDaoHibernate<Examen, Long> implements ExamenDao{

	public ExamenDaoHibernate() {
		super(Examen.class);
	}

	public List<Examen> getListExamensByPatient(Patient patient) {
		log.debug("le patient est :" + patient);
		return this.getHibernateTemplate().find("from Examen where patient=? and statut=?", patient,false);
	}

	public List getExamenByFacture(Facture facture) {
		return this.getHibernateTemplate().find("from Examen where facture=?",facture);
	}

	
	public List<Examen> getExamensByName(String query, Patient patient){
		
		return this.getHibernateTemplate().find("from Examen where numExamen like '%' || ? || '%' and patient=?",query,patient);
	}
}
